home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / ConditionalMacros.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-21  |  6.3 KB  |  227 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ConditionalMacros.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.1  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CONDITIONALMACROS__
  18. #define __CONDITIONALMACROS__
  19.  
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. #if GENERATINGPOWERPC
  26. #pragma options align=mac68k
  27. #endif
  28.  
  29. #ifdef __CFM68K__
  30. #pragma lib_export on
  31. #endif
  32.  
  33. /*
  34.     This file sets up the following compiler independent conditionals:
  35.     
  36.     GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  37.     GENERATING68K            - Compiler is generating 68k family instructions
  38.     GENERATING68881            - Compiler is generating mc68881 floating point instructions
  39.     GENERATINGCFM            - Code being generated assumes CFM calling conventions
  40.     CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  41.     
  42.     SystemSevenFiveOrLater    - Compiled code will only be run on a System 7.5 or later Macintosh
  43.     SystemSevenOrLater        - Compiled code will only be run on a System 7.0 or later Macintosh
  44.     SystemSixOrLater        - Compiled code will only be run on a System 6.0 or later Macintosh
  45.                               A developer should set the appropriate flag on the compiler command-
  46.                               line or in a file processed before this file.  This will allow the
  47.                               certain optimizations to be made which can result in smaller, faster
  48.                               applications.
  49.     
  50.     CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  51.                               are: all lowercase, use C strings instead of pascal strings, use 
  52.                               Point* instead of Point).
  53.  
  54.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  55.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  56.                               are now more sensitive to change because CFM binds by name.  In the 
  57.                               past, system routine names were compiled out to just an A-Trap.  
  58.                               Macros have been added that each map an old name to its new name.  
  59.                               This allows old routine names to be used in existing source files,
  60.                               but the macros only work if OLDROUTINENAMES is true.  This support
  61.                               will be removed in the near future.  Thus, all source code should 
  62.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  63.                               to see if your code has any old names left in it.
  64.     
  65.     
  66.     There are some invariants among the conditionals:
  67.     
  68.     GENERATINGPOWERPC != GENERATING68K
  69.     GENERATING68881 => GENERATING68K
  70.     GENERATINGPOWERPC => GENERATINGCFM
  71.     GENERATINGPOWERPC => CFMSYSTEMCALLS
  72.     CFMSYSTEMCALLS => GENERATINGCFM
  73.     GENERATINGPOWERPC => SystemSevenOrLater
  74.     SystemSevenFiveOrLater => SystemSevenOrLater
  75.     SystemSevenOrLater => SystemSixOrLater
  76.     
  77.     
  78. */
  79.  
  80. #ifdef GENERATINGPOWERPC
  81.     #define GENERATING68K !GENERATINGPOWERPC
  82. #endif
  83.  
  84. #ifdef GENERATING68K
  85.     #define GENERATINGPOWERPC !GENERATING68K
  86. #endif
  87.  
  88. #ifndef GENERATINGPOWERPC
  89.     #if defined(powerc) || defined(__powerc)
  90.         #define GENERATINGPOWERPC 1
  91.     #else
  92.         #define GENERATINGPOWERPC 0
  93.     #endif
  94. #endif
  95.  
  96. #ifndef GENERATING68K
  97.     #if GENERATINGPOWERPC
  98.         #define GENERATING68K 0
  99.     #else
  100.         #define GENERATING68K 1
  101.     #endif
  102. #endif
  103.  
  104. #if GENERATING68K
  105.     #if defined(applec) || defined(__SC__)
  106.         #ifdef mc68881
  107.             #define GENERATING68881 1
  108.         #endif
  109.     #elif __MWERKS__
  110.         #if __MC68881__
  111.             #define GENERATING68881 1
  112.         #endif
  113.     #endif
  114. #endif
  115.  
  116. #ifndef CGLUESUPPORTED
  117.     #define CGLUESUPPORTED 1
  118.     #if defined(THINK_C) || (defined(__SC__) && !defined(__CFM68K__))
  119.         #define CGLUESUPPORTED 0
  120.     #endif
  121. #endif
  122.  
  123. #ifndef GENERATING68881
  124.     #define GENERATING68881 0
  125. #endif
  126.  
  127. #if GENERATINGPOWERPC
  128.     #define CFMSYSTEMCALLS 1
  129.     #define GENERATINGCFM 1
  130. #endif
  131.  
  132. #ifndef GENERATINGCFM
  133.     #ifndef __CFM68K__
  134.         #define GENERATINGCFM 0
  135.         #define CFMSYSTEMCALLS 0
  136.     #else
  137.         #define GENERATINGCFM 1
  138.         #define CFMSYSTEMCALLS 1
  139.     #endif
  140. #endif
  141.  
  142. #ifndef CFMSYSTEMCALLS
  143.     #define CFMSYSTEMCALLS 0
  144. #endif
  145.  
  146. #ifndef SystemSevenFiveOrLater
  147.     #define SystemSevenFiveOrLater 0
  148. #endif
  149.  
  150. #ifndef SystemSevenOrLater
  151.     #if GENERATINGPOWERPC || SystemSevenFiveOrLater
  152.         #define SystemSevenOrLater 1
  153.     #else
  154.         #define SystemSevenOrLater 0
  155.     #endif
  156. #endif
  157.  
  158. #ifndef SystemSixOrLater
  159.     #define SystemSixOrLater SystemSevenOrLater
  160. #endif
  161.  
  162. #ifndef OLDROUTINENAMES
  163.     #define OLDROUTINENAMES 1
  164. #endif
  165.  
  166. #if OLDROUTINENAMES 
  167.     #ifndef USES68KINLINES
  168.         #define USES68KINLINES GENERATING68K
  169.     #endif
  170.     #define USESCODEFRAGMENTS GENERATINGCFM
  171.     #define USESROUTINEDESCRIPTORS GENERATINGCFM
  172. #endif
  173.  
  174. #if CFMSYSTEMCALLS
  175.     #define ONEWORDINLINE(trapNum)
  176.     #define TWOWORDINLINE(w1, w2)
  177.     #define THREEWORDINLINE(w1, w2, w3)
  178.     #define FOURWORDINLINE(w1, w2, w3, w4)
  179.     #define FIVEWORDINLINE(w1, w2, w3, w4, w5)
  180.     #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)
  181.     #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)
  182.     #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)
  183.     #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)
  184.     #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)
  185.     #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)
  186.     #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)
  187. #else
  188.     #define ONEWORDINLINE(trapNum)     \
  189.         = trapNum
  190.     #define TWOWORDINLINE(w1, w2)     \
  191.         = {w1,w2}
  192.     #define THREEWORDINLINE(w1, w2, w3)  \
  193.         = {w1,w2,w3}
  194.     #define FOURWORDINLINE(w1, w2, w3, w4)  \
  195.         = {w1,w2,w3,w4}
  196.     #define FIVEWORDINLINE(w1, w2, w3, w4, w5)  \
  197.         = {w1,w2,w3,w4,w5}
  198.     #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)  \
  199.         = {w1,w2,w3,w4,w5,w6}
  200.     #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)  \
  201.         = {w1,w2,w3,w4,w5,w6,w7}
  202.     #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)  \
  203.         = {w1,w2,w3,w4,w5,w6,w7,w8}
  204.     #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)  \
  205.         = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
  206.     #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)  \
  207.         = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
  208.     #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)  \
  209.         = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
  210.     #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)  \
  211.         = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
  212. #endif
  213.  
  214. #ifdef __CFM68K__
  215. #pragma lib_export off
  216. #endif
  217.  
  218. #if GENERATINGPOWERPC
  219. #pragma options align=reset
  220. #endif
  221.  
  222. #ifdef __cplusplus
  223. }
  224. #endif
  225.  
  226. #endif /* __CONDITIONALMACROS__ */
  227.